
<div id="comboBox" style="	<?php 	if(isset($_SESSION['config_template'])){
										if($_SESSION['config_template']=='layoutmain_web2') {?>
											margin-top:10px;
											margin-right:50px;
							<?php } else if($_SESSION['config_template']=='layoutmain_web1') {?>
									margin-right:0px;
									color:white;
							<?php } else{?>
											margin-right: -450px;
							<?php } } 
									else {?>
										margin-right: -450px;
							<?php		}?> " >
<?php echo $textLang?>
<?php if(isset($languages) && count($languages) > 0){?>
	<?php foreach ($languages as $lang){?>
		<img alt="<?php echo $lang['name'];?>" title="<?php echo $lang['name'];?>" src="<?php echo '/images/admin/flags/'.$lang['image'];?>" style="cursor: pointer;<?php if($lang['language_id']==$id_default){echo 'border:3px double #545565;';}?>" onclick="ChangeLanguage(<?php echo $lang['language_id'];?>);" onerror="this.src='/images/admin/flags/error.png'"/>
	<?php }?>
<?php }?>
</div>

<script type="text/javascript">
function ChangeLanguage(id)
{ 

	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange = function()
	{	
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			if(xmlhttp.responseText == "-1")
			{
				alert("<?php echo $error_msg;?>");
			}
			else if(xmlhttp.responseText == "1")
			{	
				window.top.location.reload();
			}
		}	
	};
	var url = "/language/language/index?language_id="+id;
	//alert(_title);
	xmlhttp.open("GET",url,true);	
	xmlhttp.send();
	return false;
}

</script>
